import request from "@/utils/request";
export interface categoryViewModel {
  id: number;
  category1Id: number;
  category1Name: string;
  category2Id: number;
  category2Name: string;
  category3Id: number;
  category3Name: string;
}

export interface skuImageListModel {
  id: number;
  skuId: number;
  imgName: string;
  imgUrl: string;
  spuImgId: number;
  isDefault: string;
}
export interface skuAttrValueListModel {
  id: number;
  attrId: number;
  valueId: number;
  skuId: number;
  attrName: string;
  valueName: string;
}
export interface skuSaleAttrValueListModel {
  id: number;
  skuId: number;
  spuId: number;
  saleAttrValueId: number;
  saleAttrId: number;
  saleAttrName: string;
  saleAttrValueName: string;
}
export interface skuInfoModel {
  id: number;
  spuId: number;
  price: number;
  skuName: string;
  skuDesc: string;
  weight: number;
  tmId: number;
  category3Id: number;
  skuDefaultImg: string;
  isSale: number;
  createTime: number;
  skuImageList: skuImageListModel[];
  skuAttrValueList: skuAttrValueListModel[];
  skuSaleAttrValueList: skuSaleAttrValueListModel[];
}

export interface detailData {
  valuesSkuJson: {};
  price: number;
  categoryView: categoryViewModel;
  spuSaleAttrList: [];
  skuInfo: skuInfoModel;
}
export interface detailResultData {
  code: number;
  message: string;
  data: detailData;
  ok: boolean;
}

export default {
  getDetailData(skuId: string) {
    return request.get<any, detailResultData>(`/app-dev/api/item/${skuId}`);
  },
};
